<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>DM-CtrlH7-BF-DevProgram: C:/Users/ASUS/Desktop/dm-ctrlH7-balance-9025test/Tasks/remoteTask.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="50x5.png"/></td>
  <td id="projectalign">
   <div id="projectname">DM-CtrlH7-BF-DevProgram<span id="projectnumber">&#160;beta 0.1</span>
   </div>
   <div id="projectbrief">C.ONE Studio Damiao Development Board Framework</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search',true);
  $(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(function(){initNavTree('remote_task_8c.html','',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="headertitle"><div class="title">remoteTask.c File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>遥控器接受与发送的任务（没有写在DMA）  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;cmsis_os.h&quot;</code><br />
<code>#include &quot;<a class="el" href="tim_8h_source.html">tim.h</a>&quot;</code><br />
<code>#include &quot;delayticks.h&quot;</code><br />
<code>#include &quot;<a class="el" href="remote_task_8h_source.html">remoteTask.h</a>&quot;</code><br />
<code>#include &quot;string.h&quot;</code><br />
<code>#include &quot;<a class="el" href="usart_8h_source.html">usart.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-define-members" class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a8787210b33220cae4837fbbfac16e494" id="r_a8787210b33220cae4837fbbfac16e494"><td class="memItemLeft" align="right" valign="top"><a id="a8787210b33220cae4837fbbfac16e494" name="a8787210b33220cae4837fbbfac16e494"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>SBUS_HEAD</b>&#160;&#160;&#160;0X0F</td></tr>
<tr class="memitem:aff883458bb781ec304e987febccb2387" id="r_aff883458bb781ec304e987febccb2387"><td class="memItemLeft" align="right" valign="top"><a id="aff883458bb781ec304e987febccb2387" name="aff883458bb781ec304e987febccb2387"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>SBUS_END</b>&#160;&#160;&#160;0X00</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a3b6ae96f6a43397f92b8d7a6a0583d8d" id="r_a3b6ae96f6a43397f92b8d7a6a0583d8d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3b6ae96f6a43397f92b8d7a6a0583d8d">sbus_frame_parse</a> (<a class="el" href="structremoter__t.html">remoter_t</a> *remoter, <a class="el" href="structrc__ctrl__t.html">rc_ctrl_t</a> *rc_ctrl, uint8_t *buf)</td></tr>
<tr class="memdesc:a3b6ae96f6a43397f92b8d7a6a0583d8d"><td class="mdescLeft">&#160;</td><td class="mdescRight">解析SBUS帧数据  <br /></td></tr>
<tr class="memitem:ga925534fb8bf7ca464fd05c982fe4bfa0" id="r_ga925534fb8bf7ca464fd05c982fe4bfa0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___u_a_r_t___exported___functions___group2.html#ga925534fb8bf7ca464fd05c982fe4bfa0">HAL_UARTEx_RxEventCallback</a> (<a class="el" href="group___u_a_r_t___exported___types.html#ga5de4a49eb132735325e706f406c69d6e">UART_HandleTypeDef</a> *huart, uint16_t Size)</td></tr>
<tr class="memdesc:ga925534fb8bf7ca464fd05c982fe4bfa0"><td class="mdescLeft">&#160;</td><td class="mdescRight">每次dma/idle中断发生时，都会调用此函数.对于每个uart实例会调用对应的回调进行进一步的处理 例如:视觉协议解析/遥控器解析/裁判系统解析  <br /></td></tr>
<tr class="memitem:ga0e0456ea96d55db31de947fb3e954f18" id="r_ga0e0456ea96d55db31de947fb3e954f18"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___u_a_r_t___exported___functions___group2.html#ga0e0456ea96d55db31de947fb3e954f18">HAL_UART_ErrorCallback</a> (<a class="el" href="group___u_a_r_t___exported___types.html#ga5de4a49eb132735325e706f406c69d6e">UART_HandleTypeDef</a> *huart)</td></tr>
<tr class="memdesc:ga0e0456ea96d55db31de947fb3e954f18"><td class="mdescLeft">&#160;</td><td class="mdescRight">当串口发送/接收出现错误时,会调用此函数,此时这个函数要做的就是重新启动接收  <br /></td></tr>
<tr class="memitem:af4e22bdbbf832ceb562aabf52d5ecc0a" id="r_af4e22bdbbf832ceb562aabf52d5ecc0a"><td class="memItemLeft" align="right" valign="top"><a id="af4e22bdbbf832ceb562aabf52d5ecc0a" name="af4e22bdbbf832ceb562aabf52d5ecc0a"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>remoteTask</b> (void const *argument)</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-var-members" class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a1f52c18f819974b09c836f5294f9dfa2" id="r_a1f52c18f819974b09c836f5294f9dfa2"><td class="memItemLeft" align="right" valign="top"><a id="a1f52c18f819974b09c836f5294f9dfa2" name="a1f52c18f819974b09c836f5294f9dfa2"></a>
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>rx_buff</b> [BUFF_SIZE]</td></tr>
<tr class="memitem:a59f51723db757c35aaf2f95a257fd745" id="r_a59f51723db757c35aaf2f95a257fd745"><td class="memItemLeft" align="right" valign="top"><a id="a59f51723db757c35aaf2f95a257fd745" name="a59f51723db757c35aaf2f95a257fd745"></a>
<a class="el" href="structremoter__t.html">remoter_t</a>&#160;</td><td class="memItemRight" valign="bottom"><b>remoter</b></td></tr>
<tr class="memitem:a975f19a73d3b260edb6c41baec33a3ab" id="r_a975f19a73d3b260edb6c41baec33a3ab"><td class="memItemLeft" align="right" valign="top"><a id="a975f19a73d3b260edb6c41baec33a3ab" name="a975f19a73d3b260edb6c41baec33a3ab"></a>
<a class="el" href="structrc__ctrl__t.html">rc_ctrl_t</a>&#160;</td><td class="memItemRight" valign="bottom"><b>rc_ctrl</b></td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><p>遥控器接受与发送的任务（没有写在DMA） </p>
<dl class="section author"><dt>Author</dt><dd>TuxMonkey (<a href="#" onclick="location.href='mai'+'lto:'+'nqx'+'20'+'04@'+'gm'+'ail'+'.c'+'om'; return false;">nqx20<span class="obfuscator">.nosp@m.</span>04@g<span class="obfuscator">.nosp@m.</span>mail.<span class="obfuscator">.nosp@m.</span>com</a>) </dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>2024-09-21</dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>Copyright (c) 2024 DLMU-C.ONE</dd></dl>
<dl class="section user"><dt>修改日志:</dt><dd><table class="doxtable">
<tr>
<th>Date </th><th>Version </th><th>Author </th><th>Description </th></tr>
<tr>
<td>2024-09-21 </td><td>1.0 </td><td>TuxMonkey </td><td>内容 </td></tr>
</table>
</dd></dl>
</div><a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2>
<a id="a3b6ae96f6a43397f92b8d7a6a0583d8d" name="a3b6ae96f6a43397f92b8d7a6a0583d8d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3b6ae96f6a43397f92b8d7a6a0583d8d">&#9670;&#160;</a></span>sbus_frame_parse()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sbus_frame_parse </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structremoter__t.html">remoter_t</a> *</td>          <td class="paramname"><span class="paramname"><em>remoter</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structrc__ctrl__t.html">rc_ctrl_t</a> *</td>          <td class="paramname"><span class="paramname"><em>rc_ctrl</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *</td>          <td class="paramname"><span class="paramname"><em>buf</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>解析SBUS帧数据 </p>
<p>本函数用于解析来自SBUS遥控器的帧数据。SBUS是一种用于遥控模型的通信协议。 函数首先检查数据包是否以SBUS头部和尾部特定的字节开始和结束，以确保数据包的完整性。 如果数据包不符合预期的格式，函数将立即返回，不进行进一步处理。</p>
<p>对于特定的控制信号，比如当接收到0x0C时，标记遥控器为离线状态，其他情况下则为在线状态。 随后，函数解析数据包中的通道信号。SBUS协议支持多个通道，每个通道对应遥控器的一个控制输入。 这些通道的数值被解码并存储在remoter结构体的rc.ch数组中，供后续使用。</p>
<p>最后，函数维护四个静态变量来记录开关位置的最后状态，这在调试过程中用于跟踪用户输入的变化。</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">remoter</td><td>指向remoter_t结构体的指针，用于存储解析后的遥控器数据 </td></tr>
    <tr><td class="paramname">rc_ctrl</td><td>指向rc_ctrl_t结构体的指针，用于存储解析后的遥控器数据 </td></tr>
    <tr><td class="paramname">buf</td><td>指向接收到的数据包的指针 </td></tr>
  </table>
  </dd>
</dl>
<p>!!调试时选择remoter放在Watch窗口进行调试!!!</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a href="dir_0dd456b08668c9223ebe957b6c5d094b.html">Tasks</a></li><li class="navelem"><a href="remote_task_8c.html">remoteTask.c</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0 </li>
  </ul>
</div>
</body>
</html>
